package com.tanhua.server.controller;

import com.tanhua.model.vo.RideoVo;
import com.tanhua.server.service.RideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author SunSun
 * @date 2021/11/7
 */
@RestController
@RequestMapping("/peachblossom")
public class RideoController  {

    @Autowired
    private RideoService rideoService;

    /**
     * 发布语音
     * @param soundFile
     * @return
     */
    @PostMapping
    public ResponseEntity publishRideo(MultipartFile soundFile) throws IOException {
        rideoService.publishRideo(soundFile);
        return ResponseEntity.ok(null);
    }

    @GetMapping
    public ResponseEntity publishRideo(){
        RideoVo vo=rideoService.selectOne();
        return ResponseEntity.ok(vo);
    }
}
